package cn.zust.ly.entity;

import javax.persistence.*;
import java.util.Date;

import static javax.persistence.GenerationType.IDENTITY;

/**
 * Created by liy on 2016/10/12.
 */
@Entity
@Table(name = "tconcern")
public class Tconcern {

    private int id;
    private Tuser concerner;
    private Tuser concerned;
    private Date concernTime;

    public Tconcern () {  }


    public Tconcern(Tuser concerner, Tuser concerned, Date concernTime) {
        this.concerner = concerner;
        this.concerned = concerned;
        this.concernTime = concernTime;
    }

    @Override
    public String toString() {
        return "Tconcern{" +
                "id=" + id +
                ", concerner=" + concerner +
                ", concerned=" + concerned +
                ", concernTime=" + concernTime +
                '}';
    }
    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "id", unique = true, nullable = false)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "concerner_id")
    public Tuser getConcerner() {
        return concerner;
    }

    public void setConcerner(Tuser concerner) {
        this.concerner = concerner;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "concerned_id")
    public Tuser getConcerned() {
        return concerned;
    }

    public void setConcerned(Tuser concerned) {
        this.concerned = concerned;
    }

    @Column(name = "concern_time")
    public Date getConcernTime() {
        return concernTime;
    }

    public void setConcernTime(Date concernTime) {
        this.concernTime = concernTime;
    }
}
